<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 深拷贝就是对象的值,无论简单还是复杂类型,拷贝完毕后,修改一个另一个都不会被影响


        // 1.JSON.parse()
       let o1 = {name:'张三',age:18,books:['三国','水浒'],fn:() => 123}
       let o2 = JSON.parse(JSON.stringify(o1))

       // 修改内部值
       o1.name = '李四';
       o1.age = 44;
       o1.books.push('西游')
       console.log(o1);
       console.log(o2);
    </script>
</body>
</html>